# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-sassc
_gemname=sassc
pkgver=2.4.0
pkgrel=4
pkgdesc="Use libsass with Ruby!"
url="https://github.com/sass/sassc-ruby"
arch="noarch"
license="MIT"
depends="libsass ruby ruby-ffi"
checkdepends="ruby-minitest ruby-minitest-around ruby-test_construct"
source="https://github.com/sass/sassc-ruby/archive/v$pkgver/$pkgname-$pkgver.tar.gz
	gemspec.patch
	use-system-libsass.patch
	"
builddir="$srcdir/$_gemname-ruby-$pkgver"
options="!check"  # requires ruby-test_construct which we don't have yet

build() {
	gem build $_gemname.gemspec
}

check() {
	ruby -Ilib -e 'Dir.glob "./test/**_test.rb", &method(:require)'
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	local geminstdir="$gemdir/gems/$_gemname-$pkgver"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc
}

sha512sums="
e350bb27052a1f9d9c7376ba123b11795713692ad7077252e9245281500f6b9973a0a5f67f1785fe098a17936bf84e47a0f75d18daeb9d5eea372bbe3bf57f75  ruby-sassc-2.4.0.tar.gz
9e1f6a5ccf96d6e50749598c7b91270cfbb2cab5aad5f5aa4d25cff8f2f5fb9b8d2e2c79cb7bbcebeb41ceedaa8e102ffcf1c9924e17378eb554649236870b0e  gemspec.patch
bbaadee22d813ad9697c57147a3293eb8afef3b6217c9fa459facdccf3406615801461634d96251a7afc3293288e366e4d87745db52424d2453263a091f1a4aa  use-system-libsass.patch
"
